<template>
    <div
        class="input-content"
        :style="{
            background: props.options.color,
            'margin-bottom': props.options ? (props.options.space ? props.options.space + 'px' : 0 + 'px') : 0 + 'px'
        }">
        <div class="input-box" @click="jump(props.options)">
            <span class="icon icon-search"></span>
            <input
                disabled
                class="input"
                :style="'text-align:' + getPosition"
                :placeholder="props.options.title"
                placeholder-class="input-placeholder"
                :placeholder-style="'text-align:' + getPosition + ';height:auto'"
                ref="searchInput" />
        </div>
    </div>
</template>
<script setup name="search">
import { computed, ref } from 'vue';
const emit = defineEmits(['jump']);
const searchInput = ref();
const props = defineProps({
    options: {
        type: Object,
        default: () => {
            return {};
        }
    },
    isUniapp: {
        type: Boolean,
        default: false
    }
});
const getPosition = computed(() => {
    return props.options.position == 1 ? 'left' : 'center';
});
const jump = item => {
    if (props.isUniapp) {
        emit('jump', item);
    }
};
const inputValue = ref('');
</script>
<style lang="scss" scoped>
.input-content {
    box-sizing: border-box;
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14rpx 28rpx;
}
.input-box {
    width: 100%;
    height: 70rpx;
    border-radius: 30rpx;
    padding: 0 22rpx;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    background-color: #f5f5f5;
    .icon-search {
        display: inline-block;
        width: 34rpx;
        height: 34rpx;
        background: url(../../assets/mall/search.png) no-repeat;
        background-size: contain;
        margin-top: 5rpx;
        margin-right: 5rpx;
    }
    .clear {
        width: 50rpx;
        height: 50rpx;
        display: flex;
        justify-content: flex-end;
        align-items: center;
    }
    .icon-terms {
        display: inline-block;
        width: 32rpx;
        height: 32rpx;
        background-size: contain;
    }
    .input {
        width: 100%;
        font-size: 28rpx;
        white-space: nowrap;
        text-overflow: ellipsis;
        display: -webkit-box;
        -webkit-box-orient: vertical;
        -webkit-line-clamp: 2;
        overflow: hidden;
        color: #808080 !important;
    }
    .input::-webkit-input-placeholder {
        height: 70rpx;
        line-height: 70rpx;
        color: red;
    }

    .input-placeholder {
        color: #808080 !important;
        font-size: 24rpx;
    }
}
</style>
